package com.dms.modules.product.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Map;

/**
 * 商品SKU数据传输对象
 */
@Data
@ApiModel(value = "商品SKU DTO", description = "商品SKU数据传输对象")
@JsonIgnoreProperties(ignoreUnknown = true)
public class ProductSkuDTO {

    @ApiModelProperty("SKU ID")
    private Long id;

    @NotNull(message = "商品ID不能为空")
    @ApiModelProperty(value = "商品ID", required = true)
    private Long productId;

    @ApiModelProperty("SKU编码")
    private String skuCode;

    @NotBlank(message = "SKU名称不能为空")
    @ApiModelProperty(value = "SKU名称", required = true)
    private String skuName;

    @ApiModelProperty("规格值JSON")
    private String specValues;

    @ApiModelProperty("SKU图片")
    private String image;

    @NotNull(message = "价格不能为空")
    @Min(value = 0, message = "价格不能小于0")
    @ApiModelProperty(value = "售价", required = true)
    private BigDecimal price;

    @NotNull(message = "库存不能为空")
    @Min(value = 0, message = "库存不能小于0")
    @ApiModelProperty(value = "库存", required = true)
    private Integer stock;

    @ApiModelProperty("状态：0-禁用 1-启用")
    private Integer status = 1;

    @ApiModelProperty("管理员控制状态：0-禁用 1-启用")
    private Integer adminStatus = 1;

    @ApiModelProperty("商品名称")
    private String productName;

    @ApiModelProperty("商品主图")
    private String productMainImage;

    @ApiModelProperty("商品分类ID")
    private Long categoryId;

    @ApiModelProperty("商品分类名称")
    private String categoryName;

    @ApiModelProperty("商家ID")
    private Long merchantId;

    @ApiModelProperty("商家名称")
    private String merchantName;

    @ApiModelProperty("规格信息，格式为：{\"规格名\":\"规格值\"}")
    private Map<String, String> specs;

    public Map<String, String> getSpecs() {
        return specs;
    }

    public void setSpecs(Map<String, String> specs) {
        this.specs = specs;
    }
} 